<!doctype html>
<html>
<head>
  <meta charset="UTF-8" />
  <title>{$shop.title}-拼团详情</title>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0" />
  <meta name="apple-mobile-web-app-capable" content="yes">
  <meta name="apple-mobile-web-app-status-bar-style" content="black">
  <meta name="format-detection" content="telephone=no">
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/base.css" />
  <link rel="stylesheet" type="text/css" href="__PUBLIC__/Wx/css/detail.css" />
</head>
<body>
<div class="prodetail">
  <eq name="focus" value="0">
    <div class="attention">
      <div class="logo">
        <img src="__PUBLIC__/Wx/img/logo02.png"/>
        <h3>乡土味士</h3>
      </div>
      <i><input type="button" value="立即关注" class="gz"/></i>
    </div>
  </eq>
  <div class="swipePanel">
    <div class="swipe">
      <ul id="slider">
        <volist name="shop.h_imgs" id="vo">
          <li><a href="javascript:void(0)"><img src="{$vo}" alt='' /></a></li>
        </volist>
      </ul>
      <div id="pagenavi">
        <volist name="shop.h_imgs" id="vo"> <a href="javascript:void(0);" class="active">{$key+1}</a> </volist>
      </div>
    </div>
  </div>

  <if condition="(time() gt $shop['starttime']) and (time() lt $shop['endtime'])">
    <div class="time"><i>限时拼团</i><span>距离结束还剩</span>
      <div class="time-item"><span id="day_show">0</span>天<strong id="hour_show"><s id="h"></s>0</strong>时<strong id="minute_show"><s></s>00</strong>分<strong id="second_show"><s></s>00</strong>秒</div>
    </div>
  </if>
  <if condition="time() lt $shop['starttime']">
    <div class="time"><i>限时拼团</i><span>距离开始还有</span>
      <div class="time-item"><span id="day_show">0</span>天<strong id="hour_show"><s id="h"></s>0</strong>时<strong id="minute_show"><s></s>00</strong>分<strong id="second_show"><s></s>00</strong>秒</div>
    </div>
  </if>

  <div class="proname">
    <h2>
      <eq name="shop.type" value="0">
        <b class="xc">乡村
          <else/>
          <b class="md">门店
      </eq>
      </b>
      <span><?=msubstr($shop['title'],40)?> {$shop.u_num} {$shop.unit}</span>

      <!--<if condition="shop.c_neednum gt 0">-->

      <!--<else />-->
      <!--</if>-->


    </h2>
    <h3><em>￥<b>{$shop.actual_price}</b></em><del>原价：{$shop.price}</del>
      <span><!--<gt name="shop.actual_num" value="0">已售{$shop.actual_num}份<else/>已售0份 </gt>-->已售{$shop['actual_num']+$shop['v_num']}份</span>
    </h3>
  </div>
  <eq name="shop.type" value="0">
    <div class="place">
      <p>产地<span style="color:#333;">{$getfarm.a1}{$getfarm.a2}{$getfarm.a3} {$getfarm.a4}{$getfarm.a5} {$getfarm.village}</span></p>
      <p>责任农户<span style="color:#333;"><img src="{$getnhinfo.avatar}"/><i>{$getnhinfo.realname}</i></span></p>
    </div>
  </eq>
  <eq name="shop.c_shop_have" value="1">
    <div class="place">
      <p>自提店铺<span>{$shop.c_shop_name}</span></p>
      <p>自提地址<span>{$shop.c_shop_address}</span></p>
    </div>
  </eq>
  <div class="word">
    <h2>拼团须知

      <eq name="shop.c_do" value="1">
        <gt name="shop.c_neednum" value="0"><em >还差<i>{$shop.c_neednum}</i>份成团</em></gt>
        <else />
        <em><i>{$shop.min_num}</i>份成团</em>
      </eq>

    </h2>
    <div class="inner">
      <!--<p>{$shop.server}</p>-->
      <eq name="shop.type" value="0">
        <!--<p>1.参与拼团，达到拼团人次可成团</p>-->
        <!--<p>2.在拼团时间内，已成团也可继续参团</p>-->
        <!--<p>3.若活动时间截止，还未成团，则拼团失败，退还金额</p>-->
        <!--<p>4.活动截止后24小时内发货</p>-->
        <!--<p>5.三天内到货，社区店二次分拣，新鲜保证。你收到取货通知及取货码，凭取货码社区店取货</p>-->

        <if condition="$shop['limit_state'] eq 1">
          <p>1.同一产品每人仅限一份（2斤）；</p>
          <p>2.拼团成功24小时农户发货，拼团失败退还金额；</p>
          <p>3.同一社区拼团，产品送社区生鲜店自提；</p>
          <p>4.社区生鲜店二次分拣，品质把关，无损坏、差货烦恼；</p>
          <p>5.如社区暂无生鲜店对接，社区团友可协商收货地址或推荐认可的社区生鲜店做分拣服务；
          <p>6.如有愿为社区团友做收货分拣服务，请在公众号留言或电话027-87872733；</p>
          <p>7.本次活动限武汉三环内市区。</p>
          <else />
          <p>1.参与拼团，达到拼团人次可成团</p>
          <p>2.在拼团时间内，已成团也可继续参团</p>
          <p>3.若活动时间截止，还未成团，则拼团失败，退还金额</p>
          <p>4.活动截止后24小时内发货</p>
          <p>5.三天内到货，社区店二次分拣，新鲜保证。你收到取货通知及取货码，凭取货码社区店取货</p>
        </if>

        <else />
        <p>1.参与拼团，达到拼团人次可成团</p>
        <p>2.在拼团时间内，已成团可继续参团</p>
        <p>3.若活动截止时间，还未成团，则拼团失败，退还金额</p>
        <p>4.活动截止后，根据预定数量，次日商家进货</p>
        <p>5.到货后，社区店进行打包，新鲜保证。你会收到取货通知及取货码，凭取货码取货</p>
      </eq>
    </div>
  </div>
  <h2 style="padding: 10px 0 10px 10px;background: #fff;border: 1px #d5d5d5 solid;text-align: center" onclick="window.location.href='__MODULE__/Partner/index'">招募社区合伙人</h2>
  <!--默认无此结构-->
  <eq name="shop.c_do" value="1">
    <div class="people">
      <!--已开团-->
      <h2>
        <gt name="shop.c_neednum" value="0">已订购<span>{$shop.c_havenum}</span>份，还差<span>{$shop.c_neednum}</span>份成团</gt>
        <elt name="shop.c_neednum" value="0">已成团，还可以继续参团</elt>
      </h2>
      <div class="list">
        <ul>
          <volist name="userli" id="vo">
            <li>
              <div class="pic"><img src="{$vo.avatar}"/></div>
              <h3>{$vo.nickname}</h3>
              <b>{$vo.hometown}</b> </li>
          </volist>
        </ul>
      </div>
    </div>
  </eq>
  <!--<div class="comment">
        <h2>商品评价<a href="__MODULE__/MyEvaluate/index">2348</a></h2>
        <ul>
            <li>
                <div class="top">
                    <div class="pic"><img src="__PUBLIC__/Wx/images/pic08.jpg"/></div>
                    <h3>万倩</h3><b>安阳</b><time>2018-05-06</time>
                </div>
                <div class="wz">
                    <p>很不错的农产品，很喜欢以后还会再来的，也给朋友们推荐了，很不错希望还能吃到更多地地道道的农产品。</p>
                    <p><img src="__PUBLIC__/Wx/images/pic09.jpg"/><img src="__PUBLIC__/Wx/images/pic10.jpg"/><img src="__PUBLIC__/Wx/images/pic11.jpg"/></p>
                </div>
                <div class="number"><span>20</span><span style="background:url(__PUBLIC__/Wx/img/comm.png) no-repeat left center; background-size:20px 20px;">2</span></div>
            </li>
        </ul>
    </div>-->
  <div class="propic">
    <h2>商品详情</h2>
    <div class="intro">{$shop.content}</div>
  </div>
  <!--默认无-->

  <div class="time" style="display:none;"><span>已成团，还可继续拼团</span><b>剩余库存99人次</b></div>
  <!--window.location='__MODULE__/MyGrouporder/confirmorder'-->

  <if  condition="($sg_id eq $shop['id']) and ($c_id gt 0) ">
    <!--有副本id传来说明付款成功，显示分享按钮-->
    <div class="button">
      <input type="button" value="邀请好友拼团">
    </div>
    <else/>
    <div class="bot"> <a href="__MODULE__/Index/index">我的社区</a>
      <if condition="$shop.collect_status eq 1 "> <span class="sc sc02" data-id="{$shop.id}">已收藏</span>
        <else />
        <span class="sc" data-id="{$shop.id}">收藏</span> </if>

      <if condition="(time() gt $shop['starttime']) and (time() lt $shop['endtime'])"><i onClick="checkuser();" ><b>￥{$shop.actual_price}</b><b>立即拼团</b></i></if>
      <if condition="time() lt $shop['starttime']"><i style="background: #ccc;" ><b>￥{$shop.actual_price}</b><b>即将上架</b></i></if>

      <i class="click"><b>社区二次分拣</b><b>开心享受美味</b></i>
    </div>
  </if>
  <div class="page02" style="">
    <div class="guide">
      <div class="pic"><img src="__PUBLIC__/Wx/img/share.png"></div>
      <p>点击右上角，分享给朋友</p>
      <h5>邀请朋友一起来拼团！！！</h5>
      <h6>
        <input type="button" value="我知道了" class="know">
      </h6>
      <eq name="focus" value="0"><h4>关注后可查看订单详情</h4></eq>
    </div>
  </div>
  <div class="hint" id="hint">
    <div class="shadow" style="height:140px; margin-top:-70px;">
      <div class="close" onClick="document.getElementById('hint').style.display='none';"></div>
      <div class="succeed">
        <h2>温馨提示</h2>
        <!--<p>你还未进行<b>个人信息认证</b>，无法参与，<b>立即进行个人信息认证</b></p>-->
        <p>请填提货信息</p>
        <p style="    text-align: center;padding:0; height:40px; position:absolute; width:100%; bottom:0;">
          <input style="width:100%" type="button" value="去填写" class="right"  onclick="window.location.href='__MODULE__/Authentication/'"/>
          <!--<input type="button" value="个人信息认证" class="right"  onclick="window.location.href='__MODULE__/Authentication/'"/>
          <input onClick="document.getElementById('hint').style.display='none';" type="button" value="取消" class="left"/>-->
        </p>
      </div>
    </div>
  </div>
  <div class="hint" id="hint0">
    <div class="shadow" style="margin-top: -138px;height: 238px;">
      <div class="close" onClick="document.getElementById('hint0').style.display='none';"></div>
      <div class="succeed">
        <h2>温馨提示</h2>
        <p>你不在该小区，你可以让朋友代收，也可以自己拼团，是否继续拼团？</p>
        <h3>本商品为自提商品，社区扶农店二次分拣，开心享受美味</h3>

        <p style="padding:0px 10px 0 10px;">代收人：{$proxy_info.realname}</p>
        <p style="padding:0px 10px 0 10px;">联系电话：{$proxy_info.mobile}</p>
        <p style="padding:0px 10px 0 10px;">取货地址：{$proxy_info.address}</p>

        <p style="padding:0; height:40px; position:absolute; width:100%; bottom:0;">
          <input type="button" value="继续参团" class="right" onclick="window.location.href='__MODULE__/MyGrouporder/confirmorder/id/{$shop.id}/copy_id/{$shop.copy_id}/'">
          <input type="button" value="返回我的社区" class="left" onclick="window.location.href='http://www.xiangtws.com/index.php/Wx/Index/index/'">
        </p>
      </div>
    </div>
  </div>
  <!--未关注的人支付成功后出现-->
  <div class="hint03">
    <div class="shadow">
      <div class="close"></div>
      <div class="succeed">
        <h2>温馨提示</h2>
        <p>恭喜你支付成功</p>
        <h3 style="text-align:center;">关注乡土味士公众号更多惊喜等你来拿</h3>
        <p style="padding:0; height:40px; position:absolute; width:100%; bottom:0;"><input type="button" value="去关注" class="right"/><input type="button" value="返回社区" class="left"  onclick="window.location.href='http://www.xiangtws.com/index.php/Wx/Index/index.html'"/></p>
      </div>
    </div>
  </div>

  <div class="page" id="focus" style="display:none;">
    <div class="close"></div>
    <div class="inner">
      <div class="pic"><img src="__PUBLIC__/Wx/images/pic14.jpg"/><p>长按图片【识别二维码】关注公众号</p></div>
      <div class="step">
        <h2>无法识别二维码</h2>
        <p>1.打开微信，点击“添加朋友”</p>
        <p>2.点击“公众号”</p>
        <p>3.搜索公众号：“乡土味士”</p>
        <p>4.点击：关注“，完成</p>
      </div>
    </div>
    <div class="botword">社区组团预定偏远山区农产品，既能吃到好吃味道又能帮助他们</div>
  </div>
</div>
<!--引用悬浮公共导航文件-->
<include file="Public:nav" />

<script type="text/javascript" src="__PUBLIC__/Wx/js/touchScroll.js"></script>
<script type="text/javascript" src="__PUBLIC__/Wx/js/touchslider.js"></script>
<script type="text/javascript">
    //首页图片轮播
    var active = 0, as = document.getElementById('pagenavi').getElementsByTagName('a');
    for ( var i = 0; i < as.length; i++) {
        (function() {
            var j = i;
            as[i].onclick = function() {
                t.slide(j);
                return false;
            };
        })();
    }
    var t = new TouchSlider({
        id : 'slider',
        speed : 600,
        timeout : 2000,
        before : function(index) {
            as[active].className = '';
            active = index;
            as[active].className = 'active';
        }
    });
</script>
<script src="__PUBLIC__/Wx/js/jquery.js" ></script>
<script  src="__PUBLIC__/Wx/js/jquery-1.9.1.js" type="text/javascript"></script>

<script src="__PUBLIC__/js/layer/layer.js"></script>
<script type="text/javascript">
    //收藏点击事件
    $(".sc").click(function(){
        var group_id = $(this).attr('data-id');
        console.log(group_id);
        if($(this).text() ==="收藏"){
            var sc = $(this);
            $.post('/Wx/Prodetail/addCollect',{group_id:group_id},function (data) {
                if(data.status==1){
                    sc.text("已收藏");
                    sc.addClass("sc02");
                }else{
                    console.log(data.info);
                }
            })
        }else{
            var sc = $(this);
            $.post('/Wx/Prodetail/cancleCollect',{group_id:group_id},function (data) {
                if(data.status==1){
                    sc.text("收藏");
                    sc.removeClass("sc02");
                }else{
                    console.log(data.info);
                }
            })
        }
    });

    $(".click span").click(function(){
        if($(this).text() ==="导航"){
            $(this).text("收起");
            $('.link02').css('display','block')
        }else{
            $(this).text("导航");
            $('.link02').css('display','none')
        }
    });

    $('.gz').click(function(){
        $('.page').css('display','block')
    });
    $('.button input').click(function(){
        $('.page02').css('display','block')
    });
    $('.know').click(function(){
        $('.page02').css('display','none')
    });
    $('.close').click(function(){
        $('#hint').css('display','none')
    });
    $('.page .close').click(function(){
        $('.page').css('display','none')
    });
</script>
<script type="text/javascript">
    (function($){
        $(function(){
            var $Width = $('.people .list ul').width()/5.3;
            var len = $(".people .list ul li").length;
            //	alert(len);
            $('.people .list ul li').css({'width':$Width});
            $('.people .list ul').css({'width':$Width*len});
        })
    })(jQuery)
</script>
<script type="text/javascript">
    <if condition="(time() gt $shop['starttime']) and (time() lt $shop['endtime'])">
        var intDiff = parseInt(<?php echo $shop['endtime']-time();?>);//倒计时总秒数量
    </if>
    <if condition="time() lt $shop['starttime']">
        var intDiff = parseInt(<?php echo $shop['starttime']-time();?>);//倒计时总秒数量
    </if>



    function timer(intDiff){
        window.setInterval(function(){
            var day=0,
                hour=00,
                minute=0,
                second=0;//时间默认值
            if(intDiff > 0){
                day = Math.floor(intDiff / (60 * 60 * 24));
                hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
                minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
                second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
            }
            if (minute <= 9) minute = '0' + minute;
            if (second <= 9) second = '0' + second;
            $('#day_show').html(day+"");
            $('#hour_show').html('<s id="h"></s>'+hour+'');
            $('#minute_show').html('<s></s>'+minute+'');
            $('#second_show').html('<s></s>'+second+'');
            intDiff--;
        }, 1000);
    }
    $(function(){
        timer(intDiff);
    });
</script>
<script type="text/javascript">
    function checkuser(){
        var isOrder = {$isOrder};
        if(isOrder==1){
            alert('您已购买过本商品');
            return false;
        }
        $.post('<?=U("Prodetail/checkuser")?>',{comid:<eq name="shop.comid" value=''>0<else/>{$shop.comid}</eq>,sg_id:{$shop.id}},function (data) {
            //data=JSON.parse(data);
            if(data['state']=="ok"){
                //alert('ok');
                window.location.href="__MODULE__/MyGrouporder/confirmorder/id/{$shop.id}/copy_id/{$shop.copy_id}/";
            }
            //alert(data['state']);
            if(data['state']=='focus'){
                //没有关注
                //alert("need");
                $("#focus").css("display","block");
            }
            if(data['state']=='need'){
                //信息不全
                //alert("need");
                $("#hint").css("display","block");
            }
            if(data['state']=='otherarea'){
                //不在一个小区
                //alert("need");
                $("#hint0").css("display","block");
            }
            //没有登录，授权注册并登录
            if(data['state']=="login"){
                //alert(data['url']);
                window.location.reload(data['url']);
            }
        })
    }//end fun
</script>
<include file="Public/wxshare" title="{$shop.title}" desc="马上拼团，社区店二次分拣，品质保证" imgurl="{$shop['h_imgs'][0]}" url="http://www.xiangtws.com/Wx/Prodetail/Index/id/{$shop.id}/u_id/{$Think.session.u_id}/c_id/{$shop.copy_id}/" />
</body>
</html>